#include "interface.h"
#include "omni_wheel.h"

Interface_gimbal_to_chassis gimbal_to_chassis={0};
Interface_power_to_chassis power_to_chassis={0};

void interface_callback(CAN_RxHeaderTypeDef* rx_header, uint8_t* data)
{
	if (rx_header->StdId == 0x111)
	{
		gimbal_to_chassis.Vx = data[0] | (data[1] << 8);
		gimbal_to_chassis.Vy = data[2] | (data[3] << 8);
		gimbal_to_chassis.Vw = data[4] | (data[5] << 8);
		//HAL_IWDG_Refresh(&hiwdg);
	}
	
	if (rx_header->StdId == 0x212)
	{
		power_to_chassis.I = data[0] | (data[1] << 8);
		power_to_chassis.V = data[2] | (data[3] << 8);
	}
}

void interface_change()
{
	Small_cake.Robot_in_self.velocity_exp.Vx=gimbal_to_chassis.Vx;
	Small_cake.Robot_in_self.velocity_exp.Vy=gimbal_to_chassis.Vy;
	Small_cake.Robot_in_self.velocity_exp.Vw=gimbal_to_chassis.Vw;
}
